package com.k.spring.boot.data.jpa.controller;

import com.k.spring.boot.data.jpa.entity.UserInfo;
import com.k.spring.boot.data.jpa.service.UserInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.UUID;

@Slf4j
@Controller
public class UserInfoController {
    @Autowired
    private UserInfoService userInfoService;

    @GetMapping("/index")
    @ResponseBody
    public UserInfo index() {
        UserInfo info = new UserInfo();
        info.setUserName(UUID.randomUUID().toString());
        return userInfoService.save(info);
    }
}
